package com.terranovita.gaming.pulpgui.factories;

import com.terranovita.gaming.pulpgui.layout.LinearLayout;
import com.terranovita.gaming.pulpgui.layout.Orientation;

/**
 * The layout factory will make it easy to create new layout elements.
 * 
 * TODO: update the purpose of this class. What do we really need here?
 * 
 * @author fvantom
 * 
 */
public class LayoutFactory
{
	public static LinearLayout createVerticalLayout(double horizontalGravity, double verticalGravity, int padding, int childMargin)
	{
		return createLinearLayout(Orientation.VERTICAL, horizontalGravity, verticalGravity, padding, childMargin);
	}
	
	public static LinearLayout createHorizontalLayout(double horizontalGravity, double verticalGravity, int padding, int childMargin)
	{
		return createLinearLayout(Orientation.HORIZONTAL, horizontalGravity, verticalGravity, padding, childMargin);
	}
	
	public static LinearLayout createLinearLayout(Orientation orientation, double horizontalGravity, double verticalGravity, int padding, int childMargin)
	{
		LinearLayout layout = new LinearLayout();
		layout.setOrientation(orientation);
		layout.setGravity(horizontalGravity, verticalGravity); // sets the position of the elements inside the layout container
		layout.padding.set(padding); // sets the spacing around the element
		layout.childMargin.set(childMargin); // sets the spacing between the elements
		return layout;
	}
}
